#!/usr/bin/python3
# -*- coding=utf-8 -*-

import os
import time
import datetime

def file_stay_time(filename):
    CreatedTime=time.localtime(os.stat(filename).st_ctime)
	y=time.strftime('%Y', CreatedTime)
	m=time.strftime('%m', CreatedTime)
	d=time.strftime('%d', CreatedTime)
	H=time.strftime('%H', CreatedTime)
	M=time.strftime('%M', CreatedTime)

	ctime = datetime.datetime(int(y),int(m),int(d),int(H),int(M))
#	print(ctime)

	now = datetime.datetime.now()
#	print(now)
	
	seconds_to_passed = (now-ctime).seconds

	mins_to_passed = seconds_to_passed/60

	hours_to_passed = mins_to_passed/60

	return hours_to_passed
	
if __name__ == "__main__":
	test = file_stay_time('/python/cgi-bin/bakconfig/BJRack02_ve_xxx_2016_2_21_13.txt')
	print(test)